#!/bin/csh -f
# assuming envvar DECAHOME is set
set LSOPT="$DECAHOME/scripts/lsopt urep"
set PHELP="awk -f $DECAHOME/SRC/pophelp.awk $DECAHOME/SRC/urep.help"
set tlab=0
set alab=0
set fname="u.rep"
set out=""
while( "$*" != "" )
    if ( -e $1 ) then # allow config_name option without "-"
	set fname=$1
	shift
    endif
    switch ( $1 )
	case -t:
	    shift
	    set tlab=$1
	breaksw
	case -a:
	    shift
	    set alab=$1
	breaksw
	case -x:
	    set out="x"
	breaksw
	case -h:
	    shift
	    if ( $# == 0 ) then
		$LSOPT
		exit
	    endif
	    $PHELP $1
	    exit
	breaksw
	default:
	    echo "urep: Unrecognized option "$1
	    $LSOPT
	    exit
	breaksw
    endsw
    shift
end
if (! -e $fname ) then
    echo "File $fname does not exist."
    exit
endif
if ( $out == "" ) then
    awk -f $DECAHOME/SRC/urep.awk $fname $tlab $alab
else
    awk -f $DECAHOME/SRC/urep.awk $fname $tlab $alab | xmgrace -pipe &
endif
##

